/**
 * Created by wenchuan.li 2018/5/21.
 */
define(function () {

    var self,
        app = win.app,
        user
    ;

    var reg = app.Module.extend({

        init: function () {
            self = this;

            self.data = {
                provinces: [],
                citys: [],
                industry: [],
                plants: [],
                customers: [],
                sub: {
                    GWAA017: '',//省
                    GWAA006: 'M',
                    GWAA007: '1',
                    GWAA008: '',
                    GWAA018: '',
                    GWAK001: ''
                    //industry:'',
                }
            };
            self._super({
                _sliderId: 'slider',
                _refreshAutoInit: true
            }, win);
        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scrollN', 'scrollY'];
            }
            this._super(win);
        },
        _refreshCb: function (obj) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/user/getUserList",
                xdata: {
                    page:obj.page+1,
                    limit: obj.limit,
                    status: obj.type.replace('scroll', '')
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        _super({
                            obj: obj,
                            data: data.data,
                            nodata: obj.type == 'scrollN' ? '无待审核信息...' : '无已审核信息...'
                        });
                    }
                }
            });
        },
        _slide: function (i) {

        },
        _lazy: function () { // 延迟300ms加载
            this._super();
        },
        _ready: function () { // dom载入完成后执行

            Vue.component('reg-listitem', {
                template: app.getByid(doc, 'item-template'),
                props: {
                    model: Array
                },
                methods: {
                    checkUser: function (item) {
                        app.openPage({
                            src: 'register/register-modal.html',
                            argsKey: 'register-modal',
                            args: {
                                item: app.cloneJSON(item),
                                cb: function () {
                                    self._refresh();
                                    self._refresh(1);
                                }
                            }
                        });

                    }
                }
            });

        }
    });

    new reg();

});